import request from '@/utils/request'

/**
 * 获取楼栋列表
 * @returns Object
 */
export function apiGEtFloorlist() {
    return request({
        url: '/dormitory/list',
        method: 'GET'
    })
}

/**
 * 添加楼栋
 * @param room_no    宿舍楼名称
 * @param order      宿舍楼排序
 * @returns Object
 */
export function apiSetAddFloor(param) {
    return request({
        url: '/dormitory/add',
        method: 'POST',
        data: {
            room_no: param.room_no,
            order: param.order
        }
    })
}

/**删除楼栋
 * @param id         宿舍楼id
 * @param order,     宿舍楼排序
 * @param room_no    宿舍楼名称
 * @returns Object
 */
export function apiSetDeleteFloor(param) {
    return request.post(`/dormitory/delete?id=${param.id}`)
}

/**修改楼栋
 * @param id         宿舍楼id
 * @returns Object
 */
export function apiUpDataFloor(param) {
    return request({
        method: 'post',
        url: `/dormitory/edit?id=${param.id}`,
        data: {
            order: param.order,
            room_no: param.room_no
        }
    });
}